home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / 422mods.zip / TANIS001.422 < prev    next >
Text File  |  1993-03-01  |  13KB  |  315 lines

  1. Ok i suped up the supe up, and fixed some probs with it!!!
  2. Commander Pull #1 @17315 58≡7 Commander 58≡0
  3. Fri Feb 26 18:21:13 1993
  4. ┌────────────────────────────────────────────────────────────────────────────┐
  5. │ Mod Name:    :  TANIS001.MOD        Author :  Goose 1@17310      (WWIVLink)│
  6. │ Difficulty   :  Medium - Hard       Update :  Tanis Half-Elven 1@17315     │
  7. │ WWIV Version :  4.22                Date   :  2/26/93                      │
  8. │ Files Modded :  FCNS.H, VARS.H, UTILITY.C, NEWUSER.C, DEFAULTS.C, UEDIT.C  │
  9. │                 MSGBASE.C, MSGBASE1.C, SYSOPF.C.                           │
  10. │ Description  :  The old Usernote mod for 4.12, revamped for 4.22 with extra│
  11. │                 features, and utilizes the external strings.               │
  12. └────────────────────────────────────────────────────────────────────────────┘
  13.  
  14. What this mod does is allows each user to specify a User Comment that will be 
  15. displayed at the top of the messages for local message bases.  This note can 
  16. be whatever the user wants - most sysops will put their board numbers there, 
  17. for example, other users can use it for just about anything they want.
  18.  
  19. I am rereleasing this mod for three reasons. 1. I had made some typos in the
  20. first. 2. The Usernote will now allow WWIV colors. (Becareful, 's + #'s 
  21. equal two spaces in the usernote file!!! <Multiple colors eat up the 60 space
  22. room!!> 3. The Mailr problem is now fixed.
  23.  
  24. -*-*-* Also a Specail thankyou to Galen Pathwarden for his support, and *-*-*- 
  25. -*-*-* encouragement. Thanx Galen!                                      *-*-*-
  26.  
  27. In this mod I have a string system called modstring. I substitue it for
  28. get_string. I have all the strings for the mod at the bottom, so you can add
  29. them to any external string from english.str or other modded extras.
  30.  
  31. Note that - indicates existing code, and + is new or modified code. Remember
  32. to take the + out if you are block reading stuff:
  33.  
  34. First Back up your Source!!!! I can't stress how important this is especially
  35. in a big mod like this!
  36.  
  37. First load FCNS.H. Add these two lines under UTILITY.C:
  38.  
  39. - void write_user(unsigned int un, userrec *u);
  40. + void read_note(unsigned int un);                           /* mod - add */
  41. + void write_note(unsigned int un);                          /* mod - add */
  42. - int open_qscn(void);
  43.  
  44. Save FCNS.H.
  45. Now load VARS.H and add the definition for the user note to the __EXTERN__
  46. char section:
  47.  
  48. +   ver_no2[51],wwiv_net_no[20], xdate[9], *xenviron[50], /*replace ; with,*/
  49. +   unote[81];                                      /*add unote [81] and ; */
  50.  
  51. Save VARS.H.
  52. Then load UTILITY.C, and add the following line at the top:
  53.  
  54. - #include VARS.H
  55. + extern char unote[81];                                     /* mod - add */
  56.  
  57. Search for void write_user(unsigned int un, userrec *u), and add these two new
  58. voids immediately afterward:
  59.  
  60. + void read_note(unsigned int un)             /* mod - add entire void */
  61. + {
  62. +   long pos;
  63. +   char s[80];
  64. +   int f,i;
  65. +
  66. +   sprintf(s,"%sUCOMMENT.DAT",syscfg.datadir);
  67. +   if (!exist(s)) {
  68. +     strcpy(unote,"Change Me!!!");
  69. +     f=open(s,O_RDWR | O_BINARY | O_CREAT, S_IREAD | S_IWRITE);
  70. +     for (i=0; i<=syscfg.maxusers; i++) {
  71. +       pos=(81L * (long) i);
  72. +       lseek(f,pos,SEEK_SET);
  73. +       write(f,(void *) unote, 81L);
  74. +     }
  75. +   } else {
  76. +     f=open(s,O_RDWR | O_BINARY);
  77. +     pos=(81L * (long) un);
  78. +     lseek(f,pos,SEEK_SET);
  79. +     read(f,(void *) unote, 81L);
  80. +   }
  81. +   close(f);
  82. + }
  83. +
  84. + void write_note(unsigned int un)            /* mod - add entire void */
  85. + {
  86. +   long pos;
  87. +   char s[80];
  88. +   int f,i;
  89. +
  90. +   sprintf(s,"%sUCOMMENT.DAT",syscfg.datadir);
  91. +   f=open(s,O_RDWR | O_BINARY | O_CREAT, S_IREAD | S_IWRITE);
  92. +   pos=(81L * (long) un);
  93. +   lseek(f,pos,SEEK_SET);
  94. +   write(f,(void *) unote, 81L);
  95. +   close(f);
  96. + }
  97.  
  98. Save UTILITY.C.
  99. Now in NEWUSER.C, add the line at the top: 
  100.  
  101. - #include VARS.H
  102. + extern char unote[81];                                     /* mod - add */
  103.  
  104. Then right before void newuser(void), add the following void:
  105.  
  106. + void input_usernotea(void)
  107. + {
  108. +   char s[81];
  109. +
  110. +   nl();
  111. +   pl("Enter a Usernote, a line that will appear in messages by you, below your");
  112. +   pl("name. Use it as a comment that you want other users to see. You can change");
  113. +   pl("it in the Defaults section at any time."); /*You could take this */
  114. +   nl();                                          /*out and chane to to a*/
  115. +   read_note(usernum);                            /*print file */
  116. +   npr("2%s0%s\r\n",modstring(1),unote); /*Change the modstring if needed*/
  117. +   prt(2,modstring(2));
  118. +   ansic(0);
  119. +   s[0]=0;
  120. +   inli(s,s,60,1);
  121. +   if (s[0]) {
  122. +     strcpy(unote,s);
  123. +     write_note(usernum);
  124. +   }
  125. + }
  126.  
  127. Next search down to void newuser, and add the following code to initialize
  128. the note for new users:
  129.  
  130. -       } while (((u.inact & inact_deleted)==0) && ((long)usernum<=l1));
  131. -     }
  132. -     write_user(usernum,&thisuser);
  133. +     strcpy(unote,"Change Me!!!");                          /* mod - add */
  134. +     write_note(usernum);                                   /* mod - add */
  135. +     input_usernotea();
  136. -     close_user();
  137.  
  138. Save NEWUSER.C.
  139. Then, in DEFAULTS.C, add this line at the top:
  140.  
  141. - #include VARS.H
  142. + extern char unote[81];
  143.  
  144. Next, in DEFAULTS.C, add the following line in void print_cur_stat:
  145.  
  146. -   outstr(get_string(400));  npr("%d\r\n",thisuser.optional_val);
  147. +   read_note(usernum);
  148. +   outstr(modstring(4)); npr("%s\r\n",unote);
  149. -   outstr(get_string(401));
  150. -   if (thisuser.wwiv_regnum);
  151.  
  152. Then search for void defaults, and add the "C" to the prt and onek statements.
  153. Depending on what else you may have added, there may be some difference
  154. between what is printed here and what you have.  All you need to do is add the
  155. C to the four lines:
  156.  
  157. -     if (okansi()) {
  158. +       prt(2,get_string(477));                 /* edit string 477 */
  159. +       ch=onek("Q?123456789ABCS");                /* mod - change */
  160. -     } else {
  161. +       prt(2,get_string(478));                 /* edit string 478 */
  162. +       ch=onek("Q?1234567BCS");                   /* mod - change */
  163. -     }
  164.  
  165. And near the bottom of the void, right below case 'B':
  166.  
  167. -        break;
  168. +      case 'C':                                             /* mod - add */
  169. +        nl();                                               /* mod - add */
  170. +        read_note(usernum);                                 /* mod - add */
  171. +        npr("2%s0%s\r\n",modstring(1),unote);             /* mod - add */
  172. +        prt(2,modstring(2));                                /* mod - add */
  173. +        ansic(0);                                           /* mod - add */
  174. +        s[0]=0;                                             /* mod - add */
  175. +        inli(s,s,60,1);                                     /* mod - add */
  176. +        if (s[0]) {                                         /* mod - add */
  177. +          strcpy(unote,s);                                  /* mod - add */
  178. +          write_note(usernum);                              /* mod - add */
  179. +        }                                                   /* mod - add */
  180. +        break;                                              /* mod - add */
  181. -      case 'W':
  182. -        enter_regnum();
  183.  
  184. Save DEFAULTS.C
  185. Then load UEDIT.C, and add this line at the top:
  186.  
  187. - #include VARS.H
  188. + extern char unote[81];                                     /* mod - add */
  189.  
  190. Next, search for void print_data(..).  Add the following code to display the
  191. user's note:
  192.  
  193. -   if (u->note[0]) {
  194. -     outstr(get_string(253)); pl(u->note);
  195. -   }
  196. +   read_note(un);    /* must be un, dont change! */         /* mod - add */
  197. +   npr("%s%s\r\n",modstring(3),unote);                      /* mod - add */
  198. -   if (u->ass_pts) {
  199.  
  200. Now find void uedit(...).  Add the variable X to the command line (and you may
  201. want to update the menus to show that X is update the user's comment) and add
  202. the code to edit the comment.  Also note you may not have all the other
  203. letters there - just add the X at the end:
  204.  
  205. -       prt(2,get_string(266));
  206. -       if ((realsl==255) || (wfc))
  207. +         ch=onek("Q[]{}/,.?UDRNLCPOGMSTEYZAIHB$KW~^:X");  /* mod - change */
  208. -       else
  209. +         ch=onek("Q[]{}/,.?UDRNLCPOGMSTEYZAIHB$KW^X");    /* mod - change */
  210. -       switch(ch) {
  211.  
  212. Now add the case 'X', right before case ':':
  213.  
  214. -           }
  215. -           break;
  216. +         case 'X':                                          /* mod - add */
  217. +           nl();                                            /* mod - add */
  218. +           prt(2,modstring(2));                             /* mod - add */
  219. +           ansic(0);                                        /* mod - add */
  220. +           s[0]=0;                                          /* mod - add */
  221. +           inli(s,s,60,1);                                  /* mod - add */
  222. +           if (s[0]) {                                      /* mod - add */
  223. +             strcpy(unote,s);                               /* mod - add */
  224. +             write_note(un);                                /* mod - add */
  225. +           }                                                /* mod - add */
  226. +           break;                                           /* mod - add */
  227. -         case ':':
  228.  
  229. Save UEDIT.C.
  230. Now load MSGBASE.C, and again add the following line at the top:
  231.  
  232. - #include VARS.H
  233. + extern char unote[81];                                     /* mod - add */
  234.  
  235. Then search for void read_message1(...), and add the following lines:
  236.  
  237. -       if (origin_str[0]) {
  238. -         osan(get_string(662),&abort,next);
  239. -         plan(origin_str,&abort,next);
  240. -       }
  241. +       if (unote[0]) {                                      /* mod - add */
  242. +         osan(modstring(5),&abort,next);                    /* mod - add */
  243. +         plan(unote,&abort,next);                           /* mod - add */
  244. +       }                                                    /* mod - add */
  245. -       break;
  246. -     case anony_sender:
  247.  
  248. And in void read_message(...):
  249.  
  250. -     if ((lcs()) || (ss.ability & ability_read_post_anony))
  251. -       a=1;
  252. -     else
  253. -       a=0;
  254. -     setorigin(p.ownersys, p.owneruser);
  255. +     if (p.ownersys==0)                                     /* mod - add */
  256. +       read_note(p.owneruser);                              /* mod - add */
  257. +     else                                                   /* mod - add */
  258. +       unote[0]=0;                                          /* mod - add */
  259. -     readmessage1(.....)
  260.  
  261. Save MSGBASE.C.
  262. Next to last, load MSGBASE1.C and add the external variable declaration:
  263.  
  264. - #include VARS.H
  265. + extern char unote[81];                                     /* mod - add */
  266.  
  267. Then in void readmail(void):
  268.  
  269. -         setorigin(m.fromsys, m.fromuser);
  270. +       if (m.fromsys==0)                                    /* mod - add */
  271. +         read_note(m.fromuser);                             /* mod - add */
  272. +       else                                                 /* mod - add */
  273. +         unote[0]=0;                                        /* mod - add */
  274. -         if (!abort)
  275. -           read_message1(&m.msg, (m.anony & 0x0f), i, &next, "EMAIL");
  276.  
  277. Save MSGBASE1.C.
  278. Finally, load SYSOPF.C and the external variable declaration:
  279.  
  280. - #include VARS.H
  281. + extern char unote[81];                                     /* mod - add */
  282.  
  283. Then in void mailr(void):
  284.  
  285. -         outstr(get_string(326)); pl(m.title);
  286. -         setorigin(m.fromsys, m.fromuser);
  287. +       if (m.fromsys==0)                                    /* mod - add */
  288. +         read_note(m.fromuser);                             /* mod - add */
  289. +       else                                                 /* mod - add */
  290. +         unote[0]=0;                                        /* mod - add */
  291. -         read_message1(&(m.msg),m.anony & 0x0f,1,&next,"EMAIL");
  292. -         prt(2,get_string(327));
  293.  
  294. Save SYSOPF.C.
  295.  
  296. That's it. You'll have to recompile the board since FCNS.H and VARS.H have
  297. been changed. Now, the first time you log on as new or enter defaults, the
  298. user comment will be created.  The users can then customize the comment to
  299. whatever they want, and anytime a message that they wrote is read, their
  300. current comment will be displayed.  If you have any questions, comments or
  301. problems with this mod, I can be reached at 1@17315 or via the WWIVLink Mod
  302. Discussion sub.
  303.  
  304. Oh, here are the modstring files.
  305. Modstrings list, although can be put into anything:
  306. 1: "Current User Comment : "
  307. 2: "New Comment : "
  308. 3: "Cmnt: "
  309. 4: "C. User Comment      : "
  310. 5: "Note: "
  311.  
  312. Till next mod, Cya.
  313.                   7Tanis
  314.                   5The Half-Elven
  315.